#include <algorithm>
#include <cstdint>
#include <cstdio>
#include <iostream>
#include <istream>
#include <map>

using ll = int64_t;
ll n;
std::map<ll, ll> r;

int main(){
    std::iostream::sync_with_stdio(false);
    std::cin.tie(nullptr);

    std::cin>>n;
    for(ll i=1;i<=n;i++){
        ll tmp;
        std::cin>>tmp;
        r[tmp]++;
    }
    auto idx = r.begin();
    ll lessn=idx->second;
    idx++;
    ll ans=0;
    for(;idx!=r.end();idx++){
        ll candel = std::min(idx->second,lessn);
        lessn-=candel;
        lessn+=idx->second;
        ans+=candel;
    }
    std::cout<<n-ans<<"\n";
}